<?php
/**
* Project: VsPhpFm 
* Package: VsCore
* File: vsapplication.php
*
* Version: 1.0
* Date: 20th June, 2008
* ------------------------
*
* Author: Ivan i. Atanasov johnny2000@abv.bg
*
*/

if(!defined('DIR_LIB_VSCORE'))
	define('DIR_LIB_VSCORE', DIR_LIB."VsCore".DIR_SEP);

require_once(DIR_LIB_VSCORE."db.php");
require_once(DIR_LIB_VSCORE."vsgetquery.php");

class VsApplication {
	private static $_Instance = NULL;

	private $_flags = array();
	private $_appTitle = '';

	private $_db = NULL;

	private $_getQuery = NULL;

	static function Instance() {
		if(!self::$_Instance)
			self::$_Instance = new VsApplication();

		return self::$_Instance;
	}
	//=================================================================

	private function __construct() {
		/* Flagovete trqbva da gi zarejda ot nqkav conf fajl /jelatelno XML ili MySql/ */
		$this->_flags['MultiLang'] = 'FALSE';
		$this->_flags['Smarty'] = 'FALSE';

		$this->_db = VsDatabase::Instance();

		$this->_getQuery = new VsGetQuery();
	}
	//=======================================================================

	function title() { return $this->_appTitle; }
	function setTitle($title) { $this->_appTitle = $title; }

	function getQuery() { return $this->_getQuery; }
	function queryString() { return $this->_getQuery->string(); }
	//=======================================================================

	function isMultiLang() {
		if(isset($this->_flags['MultiLang']))
			return $this->_flags['MultiLang'];

		return FALSE;
	}
	//=======================================================================

	function isSmarty() {
		if(isset($this->_flags['Smarty']))
			return $this->_flags['Smarty'];

		return FALSE;
	}
	//=======================================================================

	function db() {
		return $this->_db;
	}
	//============================================================================

	function showErrorConsole() {

	}
	//==========================================================================

	function showDebugConsole() {

	}
	//==========================================================================

};

?>
